package com.lsl.config;

import com.lsl.interceptor.MyInterptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class MyConfig2 extends WebMvcConfigurationSupport {
    @Autowired
    private MyInterptor myInterptor;
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler( "/**" ).addResourceLocations( "classpath:/static/" );
        super.addResourceHandlers(registry);
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterptor).addPathPatterns("/**").excludePathPatterns("/userlogin","/","/index","/login2","login");
        super.addInterceptors(registry);
    }
}
